import os
import time
import unittest
import HTMLTestRunner

path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
report_filename = time.strftime("back_find_order %Y-%m-%d %H-%M-%S") + '-Report.html'
file_name = os.path.join(path, 'report', report_filename)
loader = unittest.defaultTestLoader.discover('../case/backstage', "test_order*")

# 生成测试报告
with open(file_name, 'wb')as f:
    runner = HTMLTestRunner.HTMLTestRunner(
        tester='徐锐',
        title='自动化测试报告',
        description='自动化测试描述',
        stream=f,
        verbosity=2
    )
    runner.run(loader)
